﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FirstForm.cs" company="HelloWorld">
//  BY王悉奥
// </copyright>
// <summary>
//   Defines the Form1 type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WindowsFormsApp2.Form
{
    using System;
    using System.IO;
    using System.Windows.Forms;

    /// <summary>
    /// The form 1.
    /// </summary>
    public partial class FirstForm : Form
    {
        /// <summary>
        /// The file form.
        /// </summary>
        public static readonly FileForm FileForm = new FileForm();

        /// <summary>
        /// The _form.
        /// </summary>
        private readonly LoginForm form = new LoginForm();

        /// <summary>
        /// The _course form.
        /// </summary>
        private readonly CourseForm courseForm = new CourseForm();

        /// <summary>
        /// Initializes a new instance of the <see cref="FirstForm"/> class.
        /// </summary>
        public FirstForm()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// The main form_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.form.button1.Click += this.Button1_Click;
            this.pnl_unsign.Controls.Clear();
            this.form.TopLevel = false;

            // form.Dock = System.Windows.Forms.DockStyle.None;
            this.form.Anchor = AnchorStyles.Bottom;
            this.form.FormBorderStyle = FormBorderStyle.None;
            this.form.TopLevel = false;
            this.pnl_unsign.Controls.Add(this.form);
            this.form.Show();
        }

        /// <summary>
        /// The button 1_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void Button1_Click(object sender, EventArgs e)
        {
            if (this.form.DialogResult.ToString() != "OK")
            {
                return;
            }

            this.Hide();
            this.courseForm.ShowDialog();
            this.Close();
        }

        /// <summary>
        /// The file_item_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void File_tsm_item_Click(object sender, EventArgs e)
        {
            this.Hide();
            FirstForm.FileForm.ShowDialog();
            this.Show();
        }

        /// <summary>
        /// The tool strip menu item 9_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void ToolStripMenuItem9_Click(object sender, EventArgs e)
        {
            MessageBox.Show(@"欢迎留言：1198159998@qq.com");
        }

        /// <summary>
        /// The tool strip menu item 7_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void ToolStripMenuItem7_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(Path.GetFullPath("../../static/README.md"));
        }
    }
}
